--[[
-- Author:      feilong
-- DateTime:    2020-10-10 17:19:33
-- Description: 节点的服务管理
    为了更方便的取得节点中各服务的信息，
--]]


local skynet = require "skynet"


local MessageHandler = class("MessageHandler")

---------------------------------------------------------
-- Private
---------------------------------------------------------
function MessageHandler:ctor()
	self.services = {}
	self:register()	
end

--注册本服务里的消息
function MessageHandler:register()    
    g.Log():debug("i am manager register!")
    self.message_dispatch = g.MsgDis()
    self.message_dispatch:register('start', handler(self, self.start))
    self.message_dispatch:register('cluster_broadcast', handler(self, self.clusterBroadcast))
end

function MessageHandler:showService()  
    --加载了的服务列表
    g.Message():callService(".launcher", "LIST")
    g.Log():debug("list--> ", list, skynet.self())
end

---------------------------------------------------------
-- CMD
---------------------------------------------------------
function MessageHandler:start()
    g.Log():debug("manger start")

end

function MessageHandler:clusterBroadcast(from_server, msg)
    g.Log():debug("manger clusterBroadcast", from_server, msg)
    return true
end


return MessageHandler